file chooser: Fix Ctrl-L
authorMatthias Clasen <mclasen@redhat.com>
Sat, 27 Apr 2019 17:43:59 +0000 (17:43 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 27 Apr 2019 17:43:59 +0000 (17:43 +0000)
We were forwarding key events to the search entry
and unconditionally considered search started
afterwards. That is not correct, since things
like a Ctrl key press should not trigger search.
Fix this by only switching to search mode when
the event was actually consumed.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1829
gtk/gtkfilechooserwidget.c

index 1e0e2c6677941e583f552afe429d5247efe483cf..2e93cd334ee7abb8cca19ce29846832257a30ddd 100644 (file)
@@ -1411,12 +1411,13 @@ widget_key_press_cb (GtkEventControllerKey *controller,
     }
   else
     {
-      gtk_event_controller_key_forward (controller, priv->search_entry);
-
-      if (priv->operation_mode != OPERATION_MODE_SEARCH)
-        operation_mode_set (impl, OPERATION_MODE_SEARCH);
+      if (gtk_event_controller_key_forward (controller, priv->search_entry))
+        {
+          if (priv->operation_mode != OPERATION_MODE_SEARCH)
+            operation_mode_set (impl, OPERATION_MODE_SEARCH);
 
-      handled = TRUE;
+          handled = TRUE;
+        }
     }
 
   g_object_unref (event);